package zmm

import (
	"context"
	"github.com/tiger1103/gfast/v3/api/v1/zmm"
	"github.com/tiger1103/gfast/v3/internal/app/system/controller"
	"github.com/tiger1103/gfast/v3/internal/app/zmm/service"
)

var ZmmShop = zmmShopController{}

type zmmShopController struct {
	controller.BaseController
}

// List 列表
func (c *zmmShopController) List(ctx context.Context, req *zmm.ZmmShopListReq) (res *zmm.ZmmShopListRes, err error) {
	res = new(zmm.ZmmShopListRes)
	res.ZmmShopList, err = service.ZmmShop().GetList(ctx, req)
	return
}

func (c *zmmShopController) Edit(ctx context.Context, req *zmm.ZmmShopEditReq) (res *zmm.ZmmShopEditRes, err error) {
	res = new(zmm.ZmmShopEditRes)
	_, err = service.ZmmShop().Edit(ctx, req)
	if err != nil {
		return nil, err
	}
	return
}

func (c *zmmShopController) Delete(ctx context.Context, req *zmm.ZmmShopDelReq) (res *zmm.ZmmShopDelRes, err error) {
	res = new(zmm.ZmmShopDelRes)
	err = service.ZmmShop().Delete(ctx, req)
	if err != nil {
		return nil, err
	}
	return
}

func (c *zmmShopController) Statistics(ctx context.Context, req *zmm.ZmmShopStatisticsReq) (res *zmm.ZmmShopStatisticsRes, err error) {

	res, err = service.ZmmShop().GetStatistics(ctx, req)
	return
}
